Skip to content

Add tests for molecules accessible list#81

Merged
brandongregoryscott merged 10 commits into
rsm-hcd:mainfrom
SaidShah:add-tests-for-molecules-accessible-list
Dec 2, 2020
Merged

Add tests for molecules accessible list#81
brandongregoryscott merged 10 commits into
rsm-hcd:mainfrom
SaidShah:add-tests-for-molecules-accessible-list

Conversation

@SaidShah
Copy link
Copy Markdown
Contributor

  • Related GitHub issue(s) linked in PR description
  • Destination branch merged, built and tested with your changes
  • Code formatted and follows best practices and patterns
  • Code builds cleanly (no additional warnings or errors)
  • Manually tested
  • Automated tests are passing
  • No decreases in automated test coverage
  • Documentation updated (readme, docs, comments, etc.)
  • Localization: No hard-coded error messages in code files (minimally in string constants)
  • New component and/ or properties? Make sure to update storybook

Closes #19

@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 24, 2020

Codecov Report

Merging #81 (ed52703) into main (70b2f45) will increase coverage by 3.88%.
The diff coverage is 63.63%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #81      +/-   ##
==========================================
+ Coverage   34.88%   38.76%   +3.88%     
==========================================
  Files          51       51              
  Lines         903      908       +5     
  Branches      209      206       -3     
==========================================
+ Hits          315      352      +37     
+ Misses        588      556      -32     
Impacted Files Coverage Δ
src/molecules/accessible-list/accessible-list.tsx 75.00% <63.63%> (+75.00%) ⬆️
src/constants/keyboard-keys.ts 100.00% <0.00%> (+100.00%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 70b2f45...681b955. Read the comment docs.

Copy link
Copy Markdown
Contributor

@brandongregoryscott brandongregoryscott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one question about that invalid element test, I just want to make sure the test is actually doing what we're thinking it does. If you comment out the logic in AccessibleList that validates that the child is a valid element, does that test break?

);

// Assert
expect(container.innerHTML).not.toContain("null");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this is actually testing what we think we're testing. I've seen null used as a "short-circuit" return in a component that is not meant to render due to a certain condition, but that doesn't mean it renders the text "null" in the DOM. Is there a way to easily check for number of children from the returned container? Or perhaps that every child is of type button, since that's the only valid element we're using as children?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brandongregoryscott I removed the check for valid react element to test and it does break when passing in null and undefined. I changed the Assert to check and make sure the total child nodes being rendered is a value of 2 since we are only creating 2 valid nodes. I think this would address your concerns, but please let me know if you would like any other changes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for double checking that. Weird, I would not expect null or undefined to be in the inner HTML. Sorry for the late response, this looks good to go 👍

@brandongregoryscott brandongregoryscott merged commit 29c8649 into rsm-hcd:main Dec 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Backfill tests for Molecules/AccessibleList

2 participants